package cn.com.nes.site.entity.vo.workOrder;

import cn.com.nes.site.entity.bo.BaseBO;
import cn.com.nes.site.entity.vo.BaseVO;
import cn.com.nes.site.service.workOrder.bo.GetWorkOrderStatisticalBO;
import cn.hutool.core.util.StrUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * 查询工单统计结果VO
 *
 * @Author: ShenWei
 * @Date: 2024/09/04/11:16
 */
@Data
public class GetWorkOrderStatisticalVO extends BaseVO {
    @ApiModelProperty(value = "行政区划编码")
    private String areaCode;

    @ApiModelProperty(value = "项目UUID")
    private List<String> projectUuidList;

    @ApiModelProperty(value = "施工人员id - 热链云")
    private Long maintainId;

    @ApiModelProperty(value = "时间段 - 起始时间")
    private String startTime;

    @ApiModelProperty(value = "时间段 - 截止时间")
    private String endTime;


    public GetWorkOrderStatisticalBO convertToBo() throws Exception{
        GetWorkOrderStatisticalBO bo = new GetWorkOrderStatisticalBO();
        GetWorkOrderStatisticalBO getWorkOrderStatisticalBO = super.convertToBo(bo);

        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        getWorkOrderStatisticalBO.setStartTime(StrUtil.isBlank(this.startTime) ? null : format.parse(this.startTime));
        getWorkOrderStatisticalBO.setEndTime(StrUtil.isBlank(this.endTime) ? null : format.parse(this.endTime));
        return bo;
    }

}
